<template>
	<view>
		<hx-navbar ref="hxnb" :config="config">
			<block slot="right">
				<view class="edit" @tap="editSignature()">
					保存
				</view>
			</block>
		</hx-navbar>
		<view class="name">
			<input type="text" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
				:placeholder="placeholderSignature" v-model="signature">
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 标题栏配置
				config: {
					title: "个性签名",
					back: true,
					color: "#111111",
					rightSlot: true,
					backgroundColor: [1, "#FFFFFF"],
				},
				placeholderSignature: '',
				signature: ''
			}
		},
		onLoad(e) {
			this.placeholderSignature = e.signature
			console.log('姓名', e)
		},
		methods: {
			editSignature() {
				if (this.signature == '') {
					this.signature = this.placeholderSignature
				}
				let data = {
					signature: this.signature
				}
				this.$api.deitInformation(data).then((res) => {
					if (res.statusCode == 200) {
						uni.navigateBack(1)
					}
				})
			}
		}
	}
</script>

<style scoped>
	.edit {
		width: 162rpx;
		height: 70rpx;
		background: #492D22;
		border-radius: 10rpx;
		text-align: center;
		line-height: 70rpx;
		font-size: 32rpx;
		color: #ffffff;
		color: #ffffff;
		margin-right: 30rpx;
	}

	.name {
		margin-top: 30rpx;
		padding: 30rpx;
		background-color: #fff;
	}
</style>
